package tech.cn.note.excel;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;

public interface JXLSTemplateDataFillService {

    /**
     * 根据excel模板填充数据
     *
     * @param templateFile
     * @param dataSource
     * @return
     * @throws Exception
     */
    byte[] processToByte(File templateFile, Map<String, Object> dataSource) throws Exception;

    /**
     * 根据excel模板填充数据
     *
     * @param templateFileInputStream
     * @param dataSource
     * @return
     * @throws Exception
     */
    byte[] processToByte(InputStream templateFileInputStream, Map<String, Object> dataSource) throws Exception;

    /**
     * 根据Excel模板填充数据并转换为PDF
     *
     * @param templateFile
     * @param dataSource
     * @return
     * @throws Exception
     */
    byte[] processToPdfByte(File templateFile, Map<String, Object> dataSource) throws Exception;

    /**
     * 根据Excel模板填充数据并写入文件中
     *
     * @param templateFile
     * @param outFile
     * @param dataSource
     * @throws Exception
     */
    void writeToFile(File templateFile, File outFile, Map<String, Object> dataSource) throws Exception;

    /**
     * 根据Excel模板填充数据并写入流中
     *
     * @param templateFile
     * @param outPut
     * @param dataSource
     * @throws Exception
     */
    void writeToOutputStream(File templateFile, OutputStream outPut, Map<String, Object> dataSource) throws Exception;

    /**
     * 根据Excel模板填充数据并写入流中
     *
     * @param inputStream
     * @param outPut
     * @param dataSource
     * @throws Exception
     */
    void writeToOutputStream(InputStream inputStream, OutputStream outPut, Map<String, Object> dataSource) throws Exception;

}
